import 'package:flutter/material.dart';

class EgGridView extends StatelessWidget {
  List<Container> _buildGradTitleList(int count) {
    return new List<Container>.generate(
        count,
        (int index) => new Container(
              child: new Image.asset("images/$index.png"),
            ));
  }

  Widget getGridView() {
    return new GridView.extent(
      maxCrossAxisExtent: 180,
      padding: EdgeInsets.all(10),
      mainAxisSpacing: 4.0,
      crossAxisSpacing: 4.0,
      children: _buildGradTitleList(9),
    );
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("网格布局展示"),
      ),
      body: new Center(
        child: getGridView(),
      ),
    );
  }
}
